package com.jt.resource.aspect;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Slf4j
@Aspect
@Component
public class LogAspect {
    @Pointcut("@annotation(com.jt.resource.annotation.RequiredLog)")
    public void doLog(){}
    @Around("doLog()")
//    @Around(@annotation(com.jt.resource.annotation.RequiredLog))
    public Object doAround(ProceedingJoinPoint jp) throws Throwable {
        log.info("Around.Before {}",System.currentTimeMillis());
        Object result = jp.proceed();
        log.info("Around.After {}",System.currentTimeMillis());
        return result;
    }

}
